<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<!-- <script src="../resources/accessibility-helper.js"></script> -->

<div id="container">
  <table role="presentation">
    <tr>
      <td>A</td><td>B</td>
    </tr>
    <tr>
      <td>C</td><td>D</td>
    </tr>
  </table>
</div>

<pre id="console"></pre>
<script>
  // buildAccessibilityTree(accessibilityController.accessibleElementById('container'), 0, 1, []);
test(() => {
  var axTableContainer = accessibilityController.accessibleElementById('container').childAtIndex(0);
  assert_equals(axTableContainer.childrenCount, 1);
  var axSectionContainer = axTableContainer.childAtIndex(0);
  assert_equals(axSectionContainer.role, "AXRole: AXGenericContainer");
  var axRowContainer = axSectionContainer.childAtIndex(0);
  assert_equals(axRowContainer.role, "AXRole: AXGenericContainer");
  var axTextContainer1 = axRowContainer.childAtIndex(0);
  assert_equals(axTextContainer1.role, "AXRole: AXGenericContainer");
  var axText1 = axTextContainer1.childAtIndex(0);
  assert_equals(axText1.role, "AXRole: AXStaticText");
  assert_equals(axText1.name, "A");
  var axTextContainer2 = axRowContainer.childAtIndex(1);
  assert_equals(axTextContainer2.role, "AXRole: AXGenericContainer");
  var axText2 = axTextContainer2.childAtIndex(0);
  assert_equals(axText2.role, "AXRole: AXStaticText");
  assert_equals(axText2.name, "B");
}, "ARIA presentation role on table element has no rows or cells.");

</script>
